<extend name="Public:common"/>

<block name="content">

    <div class="list-main layui-form">

		<div class="layui-tab">

            <ul class="layui-tab-title">

				<li class="layui-this">{:L('CLUE_LIST')}<span class="page-content">{:L('TOTAL_RECORDS')}：<span>{$pageCount|default='0'}</span> {:L('STRIP')}</span></li>

            </ul>

        </div>

		<!-- 筛选 -->
		<include file="Public/filterViewRange" />

		<div class="list-filter select-fiter" data-type="clue_status">

			<div class="list-filter-tit">{:L('CLUE_STATE')}</div>

			<!--<div class="list-filter-checkbox <eq name='clue_status' value='all'>active</eq>" data-value="all"><span class="iconfont <eq name='clue_status' value='all'>icon-square-selected<else/>icon-weixuanzhong</eq>"></span>{:L('UNLIMITED')}</div>-->

			<div class="list-filter-checkbox <if condition="in_array('-1',explode(',',$clue_status))">active</if>" data-value="-1"><span class="iconfont <if condition="in_array('-1',explode(',',$clue_status))">icon-square-selected<else/>icon-weixuanzhong</if>"></span>{:getClueStatusName(-1)}</div>

			<div class="list-filter-checkbox <if condition="in_array('1',explode(',',$clue_status))">active</if>" data-value="1"><span class="iconfont <if condition="in_array('1',explode(',',$clue_status))">icon-square-selected<else/>icon-weixuanzhong</if>"></span>{:getClueStatusName(1)}</div>

			<div class="list-filter-checkbox <if condition="in_array('2',explode(',',$clue_status))">active</if>" data-value="2"><span class="iconfont <if condition="in_array('2',explode(',',$clue_status))">icon-square-selected<else/>icon-weixuanzhong</if>"></span>{:getClueStatusName(2)}</div>

		</div>

		<div class="list-filter" data-type="highKeyword[time_range_type]">

			<div class="list-filter-tit">{:L('SELECT_TIME')}</div>

			<include file="Public/searchTimeRange" />

			<div data-value="create_time" class="filter-time-type layui-form-radio mt0 <eq name='highKeyword[time_range_type]' value='create_time'>layui-form-radioed</eq><empty name='highKeyword[time_range_type]'>layui-form-radioed</empty> ml15 fts13 gray6">
				<i class="iconfont <eq name='highKeyword[time_range_type]' value='create_time'>icon-xuanzhong<else/><empty name='highKeyword[time_range_type]'>icon-xuanzhong<else/>icon-xuanze</empty></eq> fts15"></i>
				<div>{:L('CREATE_TIME')}</div>
			</div>

			<div data-value="next_contact_time" class="filter-time-type <eq name='highKeyword[time_range_type]' value='next_contact_time'>layui-form-radioed</eq> layui-form-radio mt0 fts13 gray6">
				<i class="iconfont <eq name='highKeyword[time_range_type]' value='next_contact_time'>icon-xuanzhong<else/>icon-xuanze</eq> fts15"></i>
				<div>{:L('NEXT_CONTACT')}</div>
			</div>

			<div data-value="last_follow_time" class="filter-time-type <eq name='highKeyword[time_range_type]' value='last_follow_time'>layui-form-radioed</eq> layui-form-radio mt0 fts13 gray6">
				<i class="iconfont <eq name='highKeyword[time_range_type]' value='last_follow_time'>icon-xuanzhong<else/>icon-xuanze</eq> fts15"></i>
				<div>{:L('FINAL_FOLLOW-UP')}</div>
			</div>

		</div>

		<include file="Public/filterSortBy" />

        <div class="list-header clearfix">

            <div class="header-left">

                {:FEELCRM('Clue/create','',L('ADD_CLUE'),'item-deleteBtn','','iconfont icon-xinzeng')}

            </div>

            <div class="header-right">

				<div class="customer-listOperate">

					<div class="listOperate">

						<div class="layui-form">

							<select class="layui-input" disabled><option>{:L('OPERATION')}</option></select>

						</div>

						<div class="operate hidden">

							<notempty name="istoPoolClueAuth">

								<a href="javascript:"  data-href="{:U('Clue/toPool')}" data-name="{:L('GIVE_UP_CLUES')}" id="toPoolCustomer">{:L('GIVE_UP_CLUES')}</a>

							</notempty>

							<notempty name="istransferClueAuth">

								<a href="javascript:" class="chooseMemberDetail" data-id="" data-href="{:U('Clue/transfer')}" data-name="{:L('TRANSFER')}" >{:L('TRANSFER_CLUES')}</a>

							</notempty>

							<notempty name="isDelClueAuth">

								<a href="javascript:" data-href="{:U('Clue/delete')}" data-name="{:L('DELETE')}" id="CrmListDelete">{:L('DELETE_CLUE')}</a>

							</notempty>

							<notempty name="isExportClueAuth">

								<a href="javascript:" title="{:L('EXPORT')}" id="startExport">{:L('EXPORT_DATA')}</a>

							</notempty>

							<notempty name="isImportClueAuth">

								<a href="javascript:" id="uploadFile">{:L('IMPORT_CUSTOMER')}</a>

								<a href="__ROOT__/{$importTemp}" title="{:L('CLUE_IMPORT_TEMPLATE')}" download="{:L('CLUE_IMPORT_TEMPLATE')}" >{:L('DOWNLOAD_TEMPLATE')}</a>

							</notempty>

						</div>

					</div>

				</div>

				<span class="advanced-searc-btn fr" id="advanced-search-btn"><i class="iconfont icon-shaixuan"></i> <span>{:L('ADVANCED_SEARCH')}</span></span>

                <form action="{$controllerAndAction}" method="get" class="fr" id="filterForm">

					<input type="hidden" name='highKeyword[condition]' value="1" />

					<input type="hidden" name='customer_auth' value="{$customer_auth}" />

					<input type="hidden" name='clue_status' value="{$clue_status}" />

					<input type="hidden" name='sort_by' value="{$sort_by}" />

					<input type="hidden" name="highKeyword[start_time]"  value="{$highKeyword.start_time}" />

					<input type="hidden" name="highKeyword[end_time]"  value="{$highKeyword.end_time}" />

					<input type="hidden" name="highKeyword[time_range_type]" value="{$highKeyword.time_range_type}" />

					<!--<include file="Public/searchTimeRange" />-->

					<div class="compact-menu">

						<!--<notempty name="isExportClueAuth">

							<a href="javascript:" title="{:L('EXPORT')}" id="startExport"><i class="iconfont icon-export"></i></a>

						</notempty>

						<a href="javascript:" title="{:L('ADVANCED_SEARCH')}" id="advanced-search-btn"><i class="iconfont icon-shaixuan"></i></a>-->

					</div>

                    <div class="compact-search">

                        <i class="iconfont icon-search crmSearchBtn"></i>

                        <input type="text" name="keyword" value="{$keyword}" placeholder="{:L('ASSIGN_SEARCH')}/{:L('COMPANY')}" onkeydown="javascript:if (event.keyCode == 13){$(this).parents('form').submit();}" />

                       <!-- <a href="javascript:" class="searchBtn">{:L('SEARCH')}</a>-->

                    </div>

                </form>

            </div>

        </div>

		<div id="advanced-search" class="hidden feelcrm-advanced-search feeldesk-form hg100">

			<form action="{$controllerAndAction}" method="get" id="highSearchForm" class="hg100">

				<input type="hidden" name='customer_auth' value="{$customer_auth}" />

				<input type="hidden" name='clue_status' value="{$clue_status}" />

				<input type="hidden" name='sort_by' value="{$sort_by}" />

			<include file="Public/highKeywordHeader" />

					<!--<div class="layui-form-item">

						<label class="layui-form-label">

						   {:L('CLUE_LEADER')}

						</label>

						<div class="layui-input-inline">

							<select name="highKeyword[member_id]" lay-ignore id="select2" >

								<option value="">{:L('SELECT_LEADER')}</option>

								<volist name="members" id="v">

									<option value="{$v.member_id}" <eq name="highKeyword.member_id" value="$v.member_id">selected</eq>>{$v.name}</option>

								</volist>

							</select>

							<script type="text/javascript">

								$("#select2").select2();

							</script>

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="{:L('ENTER_NAME_SEARCH')}"></i>

					</div>-->

					<div class="layui-form-item">

						<label class="layui-form-label">

						   {:L('CLUE_NO')}

						</label>

						<div class="layui-input-inline">

							 <input type="text" name="highKeyword[clue_no]" value="{$highKeyword.clue_no}" placeholder="{:L('NOT_CLUE_PREFIX')}" class="layui-input">

						</div>

						<i class="layui-icon layui-icon-about intro-icon" data-note="{:L('SEARCH_FUZZY_QUERY1')}"></i>

					</div>

					<include file="Public/highKeywordForm" />

				</div>

			</div>

			</form>

		</div>

        <div id='list' class="item-list feelcrm-list">

            <table class="layui-table" lay-skin="line">

                <thead>

                    <tr>

						<th class="checkbox"><input type="checkbox" name="" lay-skin="primary" lay-filter="ListAllChoose"></th>

                        <!--<th>{:L('CLUE_NO')}</th>-->

						<th>{:L('STATUS')}</th>

						<volist name="formList" id="vo">
							<!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
							<if condition="!$vo['role_id'] || in_array($index['role_id'],explode(',',$vo['role_id']))">
							<th>{$vo.form_description}</th>
							</if>
						</volist>

						<th>{:L('FINAL_FOLLOW-UP')}</th>

						<th>{:L('NEXT_CONTACT')}</th>

						<th>{:L('CREATE_TIME')}</th>

						<th>{:L('LEADER')}</th>

						<th>{:L('FOUNDER')}</th>

						<th>{:L('ENTRY_METHOD')}</th>

                    </tr>

                </thead>

                <tbody>

                    <empty name="clue">

                        <tr class="nodata center">

                            <td colspan="11">

                                <p><i class="iconfont icon-nothing fts20"></i></p>

                                <p>{:L('NO_DATA')}</p>

                            </td>

                        </tr>

                    <else />

                        <volist name="clue" id="vo">

                            <tr data-id="{$vo.clue_id|encrypt='CLUE'}" data-customer="{$vo.clue_id|encrypt='CLUE'}" data-no="{$vo.clue_prefix}{$vo.clue_no}">

								<td class="checkbox relative">

									<input type="checkbox" name="del[]" lay-skin="primary" value="{$vo.clue_id|encrypt='CLUE'}" >

								</td>

                                <!--<td onclick="clickOpenDetail(this,'clue')">{$vo.clue_prefix}{$vo.clue_no}</td>-->

								<td onclick="clickOpenDetail(this,'clue')">{:getClueStatusName($vo['status'],'html')}</td>

								<volist name="formList" id="v">
									<!-- 字段未设置查看范围或当前用户角色在查看范围内 -->
									<if condition="!$v['role_id'] || in_array($index['role_id'],explode(',',$v['role_id']))">
									<td onclick="clickOpenDetail(this,'clue')" <eq name="v.form_type" value="textarea">title="{$vo['detail'][$v['form_name']]|strip_tags}"</eq> <eq name='v.form_name' value='name'>class="blue8"</eq>>
										<eq name="v.form_type" value="textarea">
											{:mb_substr(strip_tags($vo['detail'][$v['form_name']]),0,20)}...
										<else/>

											{$vo['detail'][$v['form_name']]}

											<eq name="v.form_name" value="phone">

												<notempty name="vo['detail'][$v['form_name']]">
													<span class="icon-onclickcall"><i class="iconfont icon-boda blue8" onclick="CallUp({$vo['detail'][$v['form_name']]},3);"></i></span>
												</notempty>

											</eq>

										</eq>
									</td>
									</if>
								</volist>

                                <td onclick="clickOpenDetail(this,'clue')">{$vo.lastfollowtime|getDates}</td>

                                <td onclick="clickOpenDetail(this,'clue')">{$vo.nextcontacttime|getDates}</td>

								<td onclick="clickOpenDetail(this,'clue')">{$vo.createtime|getDates}</td>

                                <td onclick="clickOpenDetail(this,'clue')">{$vo.member_name}</td>

                                <td onclick="clickOpenDetail(this,'clue')" >{:getCustomerCreateName($vo['creater_id'],$vo['create_name'])}</td>

								<td onclick="clickOpenDetail(this,'clue')" >{:getCrmEntryMethod($vo['entry_method'])}</td>

                            </tr>

                        </volist>

                    </empty>

                </tbody>

            </table>

            <div class="right-list-page clearfix"><div class="feeldesk-page">{$page}</div></div>

        </div>

    </div>

	<notempty name="istransferClueAuth">

		<include file="Public/selectMember" />

	</notempty>

	<notempty name="istoPoolClueAuth">

		<include file="Public/toPool" />

	</notempty>


	<script>

		$(function(){

			$('#Memberlist .feeldesk-page a').click(function(){

				pageclick(this,'/Clue/index');

				return false;
			})

		})

	</script>

	<include file="Public/exportpage" />

	<script>

		var export_url = "/Clue/export";

		var export_action = "{$Think.ACTION_NAME}";

	</script>

	<script type="text/javascript">

		layui.use('upload', function()
		{
			var upload = layui.upload;

			upload.render(
			{
				elem:'#uploadFile',

				url: "{:U('Upload/importExcel',['source'=>'clue'])}",

				field:'excel',

				exts: 'xlsx|xls',

				accept:'file',

				before:function()
				{
					layer.msg("{:L('IMPORT_LOADING')}",{time:1000000,shift:0,offset:['100px']})
				},
				done: function(res)
				{
					if(res.error == 1)
					{
						layer.msg(res.msg,{icon:1,time:1000,shift:0,offset:['60px']},function()
						{
							window.location.href = res.url;
						});
					}
					else
					{
						layer.msg(res.msg,{icon:2,time:2000,offset:['60px']});
					}
				}
			})
		});

	</script>

</block>
